import { requestClient } from '#/api/request';

export namespace SoftwareApi {
  export interface DeviceInfo {
    id: number;
    name: string;
    app_type: number;
    status: number;
    create_time: string;
    update_time: string;
    app_version?: string;
    app_download_url?: string;
  }

  export interface DeviceTypeInfo {
    app_type: number;
    app_name: string;
  }

  export interface UpdateDeviceParams {
    id: number;
    app_version: string;
    app_download_url: string;
  }

  // 获取设备列表
  export const getDevicesList = (params: { app_type: number }) => {
    return requestClient.post<DeviceInfo[]>('/v1/get/devices/list', params);
  };

  // 获取设备类型列表
  export const getDevicesTypeList = () => {
    return requestClient.post<DeviceTypeInfo[]>('/v1/get/devices/type');
  };

  // 更新设备设置
  export const updateDeviceSetting = (params: UpdateDeviceParams) => {
    return requestClient.post('/v1/update/devices/setting/', params);
  };
}

